package com.clk.portfoy.complib;

import java.awt.Color;

import com.clk.desktop.gui.components.basic.ClkLabel;

public class ClkKZLabel extends ClkLabel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	// ---------------------------------------------------------------------------------
	public ClkKZLabel() {
		super();
		this.setHorizontalAlignment(RIGHT);
	}

	// ---------------------------------------------------------------------------------
	public void setText(String text) {
		try {
			if (text != null && text != "") {
				double deger = Double.parseDouble(text.toString());
				if (deger < 0) {
					this.setBackground(Color.RED);
				} else if (deger > 0) {
					// green
					this.setBackground(Color.GREEN);
				} else {
					// yellow
					this.setBackground(Color.YELLOW);
				}
			}
			super.setText(text.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	// ---------------------------------------------------------------------------------
}
